package com.skyworth.web.category;

import com.skyworth.web.admin.category.domain.CategoryModel;
import com.skyworth.web.admin.category.service.CategoryService;
import com.skyworth.web.common.controller.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by skyworth on 2016/8/11.
 */
@Controller
public class ApiCategoryController extends BaseController {
	Logger LOG = LoggerFactory.getLogger(ApiCategoryController.class);

	@Autowired
	private CategoryService categoryService;

	//RESTful api begin

	@ResponseBody
	@RequestMapping(value = {"/api/category/{storeId}"},method = RequestMethod.GET)
	public Iterable<CategoryModel> getStoreCategory(@PathVariable("storeId") long storeId){

		Iterable<CategoryModel> categoryModels = categoryService.findCategoryByStoreId(storeId);
		return categoryModels;
	}

}
